home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 6385 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  5.9 KB

  1. Path: pravda.aa.msen.com!not-for-mail
  2. From: crandall@mail.msen.com (Chad Randall)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Visual E - New E Developer Tool - vedev.gif (0/1)
  5. Date: 27 Mar 1996 13:35:58 GMT
  6. Organization: Msen, Inc. -- Ann Arbor, MI.
  7. Message-ID: <4jbg7u$hf0@pravda.aa.msen.com>
  8. References: <68772090@0humpty.tomate.tng.oche.de> <Dou4u8.2H1@cix.compulink.co.uk> <315906f0.9219429@news.hik.se>
  9. NNTP-Posting-Host: conch.aa.msen.com
  10. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  11.  
  12. Andreas Johansson (td93aj@te.hik.se) wrote:
  13. : E versus C/C++ (+ quest. How do I make a library in E?)
  14. : >A Visual E may be a good toy for amateur programmers to play with, but 
  15. : >anything based around E cannot be a professional development system, IMHO.
  16. : Good arguments to use C/C++
  17. : ---------------------------
  18. : 1) This expressions works in C but not in E, and it sucks without
  19. : them:
  20. : -------------------------------------------
  21. : Accessing the pointer to a member variable:
  22. : -------------------------------------------
  23. : C/C++
  24. : &(test->myptr)=10;
  25. : E (should be, but doesn't work)
  26. : {test.tjoho}:=10
  27.  
  28. I'm not sure what you are trying to do here.  {variable}
  29. returns the *address* of a member variable.  Why are
  30. you trying to change the address of a variable?
  31.  
  32. Of course, is some instances you need to pass the address
  33. of a variable to a .library routine (gadtools fe).
  34. In that case, you do need to hack a bit, and pass a dummy
  35. variable, then copy the value into the structure.
  36.  
  37.  
  38. : -----------------------------------
  39. : Case statment on a member variable:
  40. : -----------------------------------
  41. : C/C++
  42. : switch(test->myvar)
  43. : {
  44. :    .....
  45. : }
  46. : E (should be, but doesn't work)
  47. : SELECT test.myvar
  48. :   .....
  49. : ENDSELECT
  50.  
  51. Yes.  This is a bit annoying.  But it can be worked around.
  52.  
  53.  
  54. : --------------------------------------------------------------
  55. : A hole structure in a functionheader:
  56. : (I got that problem when i tried to write a BOOPSI class in E,
  57. : please do anyone have a solution for this?)
  58. : --------------------------------------------------------------
  59. : C/C++
  60. : void *dispatcher(Class *class, Object *object, Msg msg)  //(or
  61. : something like that)
  62. : {
  63. :    .....
  64. : }
  65. : E
  66. : PROC dispathcer(class:PTR TO iclass, object:PTR TO object, msg:PTR TO
  67. : msg)
  68. :    ......
  69. : ENDPROC
  70. : ----------------------------------------------------------------
  71.  
  72. I've written several BOOPSI classes in (.library) form.  The source
  73. was included in Iconian 2.96 archive.  It was removed from the 2.97
  74. release, tho, as it was getting a bit big.  Here's a recap:
  75.  
  76. PROC init_gaugeiclass()
  77.   DEF cl:PTR TO iclass
  78.   IF cl:=MakeClass('gaugeiclass','imageclass',NIL,SIZEOF gaugeidata,0)
  79.     installhook(cl.dispatcher,{gaugei_dispatcher})
  80.   ENDIF
  81. ENDPROC cl
  82.  
  83. PROC gaugei_dispatcher(cl:PTR TO iclass,obj:PTR TO object,msg:PTR TO msg)
  84. ...
  85. ENDPROC
  86.  
  87. PROC installhook(hook,func)
  88.   MOVE.L  hook,A0
  89.   MOVE.L  func,12(A0)
  90.   LEA     hookentry(PC),A1
  91.   MOVE.L  A1,8(A0)
  92.   MOVE.L  A4,16(A0)
  93.   MOVE.L  A0,D0
  94. ENDPROC D0
  95.  
  96. hookentry:
  97.   MOVEM.L D2-D7/A2-A6,-(A7)
  98.   MOVE.L  16(A0),A4
  99.   MOVE.L  A0,-(A7)
  100.   MOVE.L  A2,-(A7)
  101.   MOVE.L  A1,-(A7)
  102.   MOVE.L  12(A0),A0
  103.   JSR     (A0)
  104.   LEA     12(A7),A7
  105.   MOVEM.L (A7)+,D2-D7/A2-A6
  106.   RTS
  107.  
  108. You have to remember that E requires that A4 contain a pointer to 
  109. the global variable space.
  110.  
  111.  
  112. : 2) In some ways more advanced linker and header files
  113. : ------------------------------------------------------
  114. : In C++ you can have then a class header in a .h file. And the code
  115. : for the functions in .o files.
  116. : .h file:
  117. : class test
  118. : {
  119. :    void tjoho();
  120. : };
  121. : .o file before compiled:
  122. : void test::tjoho()
  123. : {
  124. : }
  125. : In E you must have the code and the object header in the same file.
  126. : OBJECT test
  127. : ENDOBJECT
  128. : PROC tjoho() OF test
  129. : ENDPROC
  130. : --------------------------------------------------------
  131.  
  132. BZZT!  Wrong.  Just export the class.  I'm currently
  133. building a gadget layout system in E OOP.  The base class
  134. in it's own module.  And children are in other modules.
  135. There is a problem with the E cache system, tho.  And
  136. you should always use flushcache when working with
  137. modules, or use the build command to rebuild all dependent
  138. modules.
  139.  
  140.  
  141. : Now some good arguments  for E:
  142. : -------------------------------
  143. : There are only one E compiler, no strange variations. No
  144. : troubleshoothing with different kinds of .lib files or anything.
  145. : More integrated with the inline assembler. In C there are some strange
  146. : variations how to write the inline assembler, because it's not a part
  147. : of any C standard.
  148. : More Amiga feeling in E, because of it's so close to assembler.
  149. :
  150. : Compacter code in most cases.
  151.  
  152. I don't know about this one.  My code always seems very bloated...
  153. but this may be because of the way I write code.  I have slowly
  154. learned by experimentation what things I can do to reduce size...
  155. but I still have lots of code left over from the "old" days.
  156.  
  157. : A lot of C-compilers do not have precompiled headerfiles, but E have
  158. : the module system, and a module is always compiled.
  159. : Not so strong typechecking. I know that you can use void * and long in
  160. : C almost like E, but you always have to write typeconversions and that
  161. : makes the code not look so good.
  162. : I haven't lookt so much on the LISP alike functions in E, but there
  163. : are nothing like that in C.
  164. : VERY FAST COMPILNG
  165. : YOU CAN COMPILE A PROGRAM WITHOUT THAT 10 MB THAT YOU DIDN'T AFFORD.
  166. : ---------------------------------------------------------------------
  167. : 3) And how do I make a E modules that looks like below when I run
  168. : ShowModule on it?
  169. : LIBRARY blabla
  170. :    Test(A0)
  171. : ENDLIBRARY
  172.  
  173. LIBRARY 'blabla.library',1,1,'blabla.library 1.1 (1/1/78)' IS
  174.   test
  175.  
  176. PROC test(dummy) IS EMPTY
  177.  
  178. Compile this, and you will get 2 files:
  179.  "blabla.library" and "blabla.m"
  180. Delete the "blabla.library" file and keep the "blabla.m" file
  181. as your module.  You can also go a different route, and
  182. use the "pragma2module" program, and write a .pragma
  183. file... or write a clib file, convert it to a pragma, then
  184. to a module. ;)
  185.